package com.ctgu.chatapp.model.Retrofit

import com.ctgu.chatapp.model.Retrofit.Pojo.Friend
import com.ctgu.chatapp.model.pojo.FriendShip
import com.ctgu.chatapp.model.pojo.Information
import com.ctgu.chatapp.model.pojo.RecordNew
import com.ctgu.chatapp.model.pojo.Request
import com.ctgu.chatapp.showPojo.Photo
import com.ctgu.chatapp.showPojo.SearchFriend
import okhttp3.RequestBody
import retrofit2.http.*

interface IMSService {

    /**
     * todo:用于获取指定id的信息
     * */
    @GET("user/information/{chatid}")
    suspend fun getInformation(
        @Path("chatid") chatID: Long
    ): Information


    @POST("user/information/list")
    suspend fun getFriendListInformation(
        @Body friend: List<Friend>
    ): List<Information>

    /**
     * todo:用于检测手机号是否被注册,若没有,则直接插入数据
     * */
    @POST("register/check")
    @FormUrlEncoded
    suspend fun checkPhone(
        @Field("telphone") telPhone: String,
        @Field("VC") pass: Int
    ): String

    /**
     * todo:用于获取验证码
     * */
    @GET("register/VerificationCode/{telphone}")
    suspend fun getVerificationCode(@Path("telphone") telPhone: String): Int

    /**
     * todo:用于注册
     * */
    @POST("register")
    @FormUrlEncoded
    suspend fun addUserInfo(information: Information): Boolean

    /**
     * todo:用于上传图片
     * */
    @POST("user/uploadAvatar")
    suspend fun uploadImage(@Body quest: RequestBody): String

    /**
     * todo:用于添加好友
     * */
    @POST("user/addFriend")
    @FormUrlEncoded
    suspend fun addFriend(
        @Field("uid") uid: Long,
        @Field("touid") touid: Long,
        @Field("RequestType") requestType: Int,
        @Field("type") type: String
    ): String

    /**
     * todo:用于查找好友
     * */
    @GET("user/searchFriend/{id}")
    suspend fun getSearchFriend(@Path("id") id: Long): List<SearchFriend>

    /**
     * todo:用于获取结果
     * */
    @GET("user/Friend/getResponse/{id}")
    suspend fun getResponse(@Path("id") id: Long): Request

    /**
     * todo:用于获取所有的添加好友的请求
     * */
    @GET("user/Friend/getAllRequest")
    suspend fun getAllRequest(@Path("id") id: Long): Request

    /**
     * todo:用于拉取所有的离线消息
     * */
    @GET("user/Offline")
    suspend fun getAllOffline(@Query("uid") uid: Long, @Query("id") id: Long): List<RecordNew>

    /**
     * todo:用于获取所有的照片
     * */
    @GET("user/photoWall/list/{chatID}")
    suspend fun getAllPhoto(@Path("chatID") id: Long): List<Photo>

    /**
     * todo:上传图片到图片墙
     * */
    @POST("user/photoWall/addPhoto")
    suspend fun uploadPhoto(@Body quest: RequestBody): String

    /**
     * todo:拉取所有好友id
     */
    @GET("user/friend/list/{chatID}")
    suspend fun getAllFriendList(@Path("chatID") chatID: Long): List<FriendShip>

}